Skip to content

fix: redact sensitive values in storage read command#168

Open
xr843 wants to merge 1 commit intogarrytan:mainfrom
xr843:fix/storage-read-redaction
Open

fix: redact sensitive values in storage read command#168
xr843 wants to merge 1 commit intogarrytan:mainfrom
xr843:fix/storage-read-redaction

Conversation

@xr843
Copy link
Contributor

@xr843 xr843 commented Mar 18, 2026

Summary

Addresses #18 (remaining unfixed part).

Most of issue #18 was already fixed in prior commits:

  • cookie — redacts value as ****
  • header — redacts sensitive headers
  • type — returns only character count
  • forms — redacts password field values
  • storage set — doesn't output the value

Remaining: The storage read command dumps all localStorage/sessionStorage values without redaction via JSON.stringify(storage, null, 2), potentially exposing tokens, API keys, and session data into stdout and model transcripts.

Changes

File Change
browse/src/read-commands.ts Redact values for keys matching sensitive patterns; add --show-secrets flag

Redacted patterns (case-insensitive): token, secret, key, password, auth, credential, session

Key names are preserved so agents can see what's stored without seeing the secret values. Example output:

{
  "localStorage": {
    "theme": "dark",
    "authToken": "[redacted]",
    "api_key": "[redacted]"
  }
}

A --show-secrets flag bypasses redaction when explicitly needed.

Test plan

  • All 173 tests in browse/test/commands.test.ts pass
  • Pre-existing gstack-config failure confirmed on main (not related)
  • Verify storage command redacts keys containing "token", "password", etc.
  • Verify storage --show-secrets shows full values

🤖 Generated with Claude Code

Closes garrytan#18 (remaining part).

The `storage` read command dumps all localStorage/sessionStorage values
without redaction, potentially exposing tokens, API keys, and session
data into stdout and model transcripts.

Add redaction for values whose keys match sensitive patterns (token,
secret, key, password, auth, credential, session). Key names are
preserved so agents can see what's stored. A `--show-secrets` flag
bypasses redaction when explicitly needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant